#include <bits/stdc++.h>
using namespace std;
#define int long long

int n, dig[32];
vector<array<int, 3>> ans;
signed main() {
	freopen("road.in", "r", stdin); freopen("road.out", "w", stdout);
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n; int tmp = 0, x = n;
	if (n == 0) {
		cout << "2 1\n1 114 0\n";
		return 0;
	}
	if (n == 1) {
		cout << "2 2\n1 114 0\n1 114 1";
		return 0;
	}
	while (x) {
		dig[++tmp] = x % 2;
		x /= 2;
	}
	for (int l = 1, r = tmp; l < r; ++l, --r) swap(dig[l], dig[r]);
	for (int i = 1; i < tmp; ++i) {
		ans.push_back({i, i + 1, (1 << (tmp - i - 1))});
		ans.push_back({i, i + 1, 0});
	}
	int sum = (1 << (tmp - 1));
	for (int i = 2; i <= tmp; ++i) {
		if (dig[i] == 1) {
			ans.push_back({1, i, sum});
			sum += (1 << (tmp - i));
		}
	}
	ans.push_back({1, tmp, n});
	set<int> s;
	int maxn = 0;
	for (auto i : ans) {
		maxn = max({maxn, i[0], i[1]});
		s.insert(i[0]);
		s.insert(i[1]);
	}
	cout << s.size() << " " << ans.size() << "\n";
	for (auto i : ans) {
		if (i[0] == maxn) i[0] = 114;
		if (i[1] == maxn) i[1] = 114;
		cout << i[0] << " " << i[1] << " " << i[2] << "\n";
	}
	return 0;
}
